package com.tads.torry.messagecenter.domain.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Arrays;
import java.util.Objects;

@AllArgsConstructor
@Getter
public enum UserStatus {

    /**
     *
     */
    ACTIVE(1, "启用"),
    INACTIVE(0, "停用"),
    ;

    private Integer code;
    private String decr;


    public static UserStatus parse(Integer code) {
        return Objects.isNull(code) ? null : Arrays.stream(UserStatus.values()).filter(e -> e.getCode().equals(code)).findFirst().orElse(null);
    }
}
